﻿using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace RaptorEngine.Components.Drawable
{
	public class DrawableSprite : Drawable2DComponent
	{
        private Texture2D _texture;
        public int Width { get { return _texture.Width; } }
        public int Height { get { return _texture.Height; } } 

        public DrawableSprite(Entity entity, Texture2D texture)
            :base(entity)
        {         
            _texture = texture;
        }
        public DrawableSprite(Entity entity, Texture2D texture, Color color, float alpha)
            : this(entity, texture)
        {
            Color = color;
            Alpha = alpha;
        }

        public override void Draw(SpriteBatch spritebatch)
        {
            spritebatch.Draw(
                _texture,
                new Vector2(worldMatrix.Translation.X, worldMatrix.Translation.Y),
                null,
                Color * Alpha,
                0,
                new Vector2(0, 0),
                Entity.Scale,
                SpriteEffects.None,
                0);
        }
	}
}
